const app = getApp()

Component({
    /**
     * 组件的属性列表
     */
    properties: {
        musiclist: Array
    },

    /**
     * 组件的初始数据
     */
    data: {
        playingId: -1
    },

    pageLifetimes: {
        show() {
            this.setData({
                playingId: parseInt(app.getPlayingMusicId())
            })
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {
        // 点击歌曲触发的交互
        onSelect(event) {
            const dataset = event.currentTarget.dataset
            const musicId = dataset.musicid
            this.setData({
                playingId: musicId
            })
            wx.navigateTo({
              url: `../../pages/player/player?musicId=${musicId}&index=${dataset.index}`,
            })
        }
    }
})
